package com.seeyon.apps.u8cloud.model;

import com.google.gson.Gson;
import org.apache.logging.log4j.util.Strings;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @ClassName : VoucherResult
 * @Description :
 * @CreateDate : 2025/8/18 15:51
 * @Author : CheungHowrAn
 * @Version : 1.0.0
 * @PackageName com.seeyon.apps.u8cloud.model
 * @Project : BSiEE本涩_A8_V9.0SP1
 */
public class VoucherResult {
    private String status;
    private String data;
    private List<ResultData> resultData;
    private String taskNumber;
    private String errormsg;

    // Getters and Setters
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public List<ResultData> getResultData() {
        if (Strings.isNotBlank(data)) {
            Gson gson = new Gson();
            ResultData[] resultDataArray = gson.fromJson(data, ResultData[].class);
            resultData = Arrays.asList(resultDataArray);
        } else {
            resultData = new ArrayList<>();
        }
        return resultData;
    }

    public void setResultData(List<ResultData> resultData) {
        this.resultData = resultData;
    }

    public String getTaskNumber() {
        return taskNumber;
    }

    public void setTaskNumber(String taskNumber) {
        this.taskNumber = taskNumber;
    }

    public String getErrormsg() {
        return errormsg;
    }

    public void setErrormsg(String errormsg) {
        this.errormsg = errormsg;
    }
}
